# 1. 收集库的源代码
file(GLOB SRC_LISTS "*.cpp")
# 2. 添加构建目标
add_executable(main ${SRC_LISTS})
# 3. 添加依赖库列表
target_link_libraries(main PRIVATE MyMath)
# 4. 设置输出路径
set_target_properties(main PROPERTIES 
    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
    INSTALL_RPATH "$ORIGIN/../lib"
)

# 5. 打印库文件相对 main 的相对路径
add_custom_command(
    TARGET main POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E echo
    "MyMath dynamic lib: $<TARGET_FILE:MyMath>"
    COMMENT "获取动态库的输出路径"
)

# 6. 安装 main
install(TARGETS main)